package cn.edu.scau.cmi.ema.service.propertyEditor;

import cn.edu.scau.cmi.ema.dao.EventquantitytypeDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.beans.PropertyEditorSupport;

@Component
public class EventquantitytypeEditor extends PropertyEditorSupport{

	@Autowired
	private EventquantitytypeDAO eventquantitytypeDAO;

	public void setAsText(String id) {
		if(id.length() > 0) {
			this.setValue(eventquantitytypeDAO.findEventquantitytypeById(Integer.parseInt(id)));
		}
		else
			this.setValue(null);
	}
}
